<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>Entry</title>
		<style>
			.main {
				display: flex;
				flex-direction: column;
				align-items: flex-start;
			}
			.form {
				max-width: 300px;
				display: flex;
				display: -webkit-flex;
				flex-direction: column;
				justify-content: center;
			}
			.form * {
				margin: 2px 5px;
			}
			.actions {
				display: flex;
				flex-direction: row;
				justify-content: flex-end;
			}
			.actions * {
				margin: auto 2px;
			}
		</style>
	</head>
	<body>
		<div class="main">
			{% if super_user %}
			<div class="curModels">
			<h1> Current users: </h1>
			{% for user in users %}
				<p> {{ user }} </p>
			{% endfor %}
			</div>

			<h1> Change user: </h1>
			<form class="form" action="" method="post">
				<input type="text" name="username" placeholder="Input user name." />
				<input type="password" name="password" placeholder="Input password." />
				{% for message in get_flashed_messages() %}
				<div style="text-align: right;">{{ message }}</div>
				{% endfor %}
				<div class="actions">
					<input type="submit" name="action" value="create" />
					<input type="submit" name="action" value="delete" />
					<input type="submit" name="action" value="change_password" />
				</div>
			</form>
			{% elif g.user['username'] != None %}
			<form class="form" action="" method="post">
				<input type="text" name="username" readonly="readonly" value="{{g.user['username']}}" />
				<input type="password" name="old_password" placeholder="Input old password." />
				<input type="password" name="new_password" placeholder="Input new password." />
				{% for message in get_flashed_messages() %}
				<div style="text-align: right;">{{ message }}</div>
				{% endfor %}
				<div class="actions">
					<input type="submit" name="action" value="change_my_password" />
				</div>
			</form>
			{% endif %}
		</div>
	</body>
</html>
